|
|
|
|
|
|
|
When you create and test your SQL statements, you can program them directly into your code and run the code to see whether they work. This process can be very time-consuming and frustrating, especially for complex statements. There are, however, three easier ways of developing SQL statements that might be available to you: |
|
|
|
|
|
|
|
|
The Visual Data Manager Add-in that comes with Visual Basic |
|
|
|
|
|
|
|
|
Microsoft Access (if you have a copy) |
|
|
|
|
|
|
|
|
|
Users of Microsoft Excel or Microsoft Office also have access to Microsoft Query, the tool in Access.  |
|
|
|
|
|
|
|
|
|
|
The Visual Data Manager and Access both have query builders that can help you create SQL queries. They provide dialog boxes for selecting the fields to include, and they help you with the various clauses. When you have finished testing a query with either application, you can store the query as a QueryDef in the database. This query can then be executed by name from your program. As an alternative, you can copy the code from the query builder into your program, using standard cut-and-paste operations. |
|
|
|
|
|
|
|
|
Using the Visual Data Manager |
|
|
|
|
|
|
|
|
The Visual Data Manager is a Visual Basic add-in that allows you to create and modify databases for your Visual Basic programs. The Visual Data Manager also has a window that allows you to enter and debug SQL queries. And if you don't want to try to create the query yourself, VDM has a query builder that makes it easy for you to create queries by making choices in the builder. |
|
|
|
|
|
|
|
|
|
If you want to learn about the inner workings of the Visual Data Manager, it is one of the sample projects installed with Visual Basic. The project file is VISDATA.VBP and is found in the VISDATA folder of the Samples folder.  |
|
|
|
|
|
|
|
|
|
|
To start the Visual Data Manager, simply select the Visual Data Manager item from the Add-Ins menu of Visual Basic. After starting the program, open the File menu and select the Open Database item; then select the type of database to open from the submenu. You are presented with a dialog box that allows you to open a database. After the database is opened, a list of the tables and queries in the database appears in the left window of the application. The Visual Data Manager with the Triton.Mdb database open is shown in Figure C.11. |
|
|
|
|
|